.class public Lde/dealdoktor/app/db/DatabaseAdapter;
.super Landroid/database/sqlite/SQLiteOpenHelper;
.source "DatabaseAdapter.java"


# static fields
.field private static final DATABASE_NAME:Ljava/lang/String; = "dealdoktor.db"

.field private static final DATABASE_VERSION:I = 0xe

.field public static final TABLE_BOOKMARKS:Ljava/lang/String; = "bookmarks"

.field private static instance:Lde/dealdoktor/app/db/DatabaseAdapter;


# direct methods
.method private constructor <init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)V
    .locals 0
    .parameter "context"
    .parameter "name"
    .parameter "factory"
    .parameter "version"

    .prologue
    .line 17
    invoke-direct {p0, p1, p2, p3, p4}, Landroid/database/sqlite/SQLiteOpenHelper;-><init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)V

    .line 18
    return-void
.end method

.method public static final getInstance(Landroid/content/Context;)Lde/dealdoktor/app/db/DatabaseAdapter;
    .locals 1
    .parameter "context"

    .prologue
    .line 39
    invoke-static {p0}, Lde/dealdoktor/app/db/DatabaseAdapter;->initialize(Landroid/content/Context;)V

    .line 40
    sget-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    return-object v0
.end method

.method private static initialize(Landroid/content/Context;)V
    .locals 4
    .parameter "context"

    .prologue
    .line 33
    sget-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    if-nez v0, :cond_0

    .line 34
    new-instance v0, Lde/dealdoktor/app/db/DatabaseAdapter;

    const-string v1, "dealdoktor.db"

    const/4 v2, 0x0

    const/16 v3, 0xe

    invoke-direct {v0, p0, v1, v2, v3}, Lde/dealdoktor/app/db/DatabaseAdapter;-><init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)V

    sput-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    .line 36
    :cond_0
    return-void
.end method


# virtual methods
.method public close()V
    .locals 1

    .prologue
    .line 48
    sget-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    if-eqz v0, :cond_0

    .line 49
    sget-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    invoke-virtual {v0}, Lde/dealdoktor/app/db/DatabaseAdapter;->close()V

    .line 50
    const/4 v0, 0x0

    sput-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    .line 52
    :cond_0
    return-void
.end method

.method public getDatabase()Landroid/database/sqlite/SQLiteDatabase;
    .locals 1

    .prologue
    .line 44
    sget-object v0, Lde/dealdoktor/app/db/DatabaseAdapter;->instance:Lde/dealdoktor/app/db/DatabaseAdapter;

    invoke-virtual {v0}, Lde/dealdoktor/app/db/DatabaseAdapter;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    return-object v0
.end method

.method public onCreate(Landroid/database/sqlite/SQLiteDatabase;)V
    .locals 1
    .parameter "db"

    .prologue
    .line 22
    const-string v0, "CREATE TABLE IF NOT EXISTS info (key varchar primary key, value varchar)"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 23
    const-string v0, "CREATE TABLE IF NOT EXISTS categories (id int primary key, title varchar(255), description varchar(255), parent int, selected int(1), updated int(1))"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 24
    const-string v0, "CREATE TABLE IF NOT EXISTS bookmarks (id int primary key)"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 25
    return-void
.end method

.method public onUpgrade(Landroid/database/sqlite/SQLiteDatabase;II)V
    .locals 0
    .parameter "db"
    .parameter "oldVersion"
    .parameter "newVersion"

    .prologue
    .line 29
    invoke-virtual {p0, p1}, Lde/dealdoktor/app/db/DatabaseAdapter;->onCreate(Landroid/database/sqlite/SQLiteDatabase;)V

    .line 30
    return-void
.end method
